<?php
/*
 * Creative Bulletin Board Generation 3
 * Version 1.0 Beta 1
 +------------------------------------
 * User Application Models: Permission Keys.
 * Started: September 25, 2009 5:41 PM (Week 1, Day 7 - Final)
 * Script version: 1.0
 */
class permissionkeys{
	public function create($key, $default_value, $guest_value = NULL){
		global $db, $main;
		$key = $main->secure_string($key);
		$default_value = $main->secure_string($key);
		$guest_value = ($guest_value ? $guest_value : $default_value);
		$built = "INSERT INTO `".DB_PREFIX."permission_keys` (
			`id`, `key`, `default_value`, `guest_value`, `name`, `desc`)
			VALUES(NULL, '{$key}', '{$default_value}', '{$guest_value}', '', '')";
		$query = $db->query($built);
		return $query;
	}
	
	public function select_all(){
		global $db;
		if(!isset($this->query)){
			$this->query = $db->select("permission_keys");
		}
		return $this->query;
	}
}
